package com.mccken.demo.io.netty.client;

import com.mccken.demo.io.netty.support.RpcResponse;
import com.mccken.demo.io.netty.codec.MyDecoder;
import com.mccken.demo.io.netty.codec.MyEncoder;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2022-04-30 20:49
 **/
public class ClientInitializer extends ChannelInitializer<SocketChannel> {

	private static final ClientHandler CLIENT_HANDLER = new ClientHandler();
	
	@Override
	protected void initChannel(SocketChannel ch) throws Exception {
		
		ch.pipeline()
				.addLast(new MyDecoder(RpcResponse.class))
				.addLast(new MyEncoder())
				.addLast(CLIENT_HANDLER);
	}
}
